<!DOCTYPE html>

<div>
  <span>1</span>
  <span id='c2'>2</span>
</div>

<script>
    if (window.testRunner)
        testRunner.waitUntilDone();

    var callback;
    var fullscreenChanged = function(event)
    {
        if (callback)
            callback(event)
    };
    document.addEventListener('webkitfullscreenchange', fullscreenChanged);

    document.body.offsetTop;
    var span = document.getElementById('c2');
    var div = span.parentNode;

    var spanEnteredFullScreen = function(event) {
        setTimeout(function () {
            span.appendChild(document.createElement('div'));
            callback = function() {
                if (window.testRunner)
                    testRunner.notifyDone();
            }
            document.webkitCancelFullScreen();
        }, 0);
    };

    callback = spanEnteredFullScreen;

    document.addEventListener('keydown', function () {
        span.webkitRequestFullScreen();
    });
    if (window.eventSender)
        eventSender.keyDown('a');
</script>
